﻿@{
    Layout = null;
    var dt = ViewBag.Data as System.Data.DataTable;
}
<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Expires" content="0" />
    <meta http-equiv="Cache" content="no-cache" />
    <title>诊疗路径名称编辑</title>
    <link rel="stylesheet" href="~/Scripts/ligerUI/skins/Aqua/css/ligerui-all.css" />
    <link rel="stylesheet" href="~/Scripts/ligerUI/skins/ligerui-icons.css" />
    <link rel="stylesheet" href="~/Scripts/ligerUI/skins/Gray/css/all.css" />
    <link rel="stylesheet" href="~/Content/css/common.css" />
    <script src="~/Scripts/jquery-1.10.2.min.js"  ></script>
    <script src="~/Scripts/ligerUI/js/ligerui.all.js"></script>
    <script src="~/Scripts/common.js?v=@DateTime.Now.ToString("yyyyMMdd")"></script>
    <style>
    .gridtable { width: 400px; margin: 0px; }
    .gridtable td { height: 30px; line-height: 30px;  }
        .radio_label {
            display: inline-block;
            width: auto;
            height: 22px;
            background: url(/Content/images/radiobutton.png) no-repeat;
            background-position: -13px -16px;
            text-indent: 22px;
            line-height: 22px;
        }

            .radio_label:hover {
                background-position: -13px -116px;
            }

        .checkbox_label {
            display: inline-block;
            width: auto;
            height: 22px;
            background: url(/Content/images/checkboxbutton.png) no-repeat;
            background-position: -13px -16px;
            text-indent: 22px;
            line-height: 22px;
        }

            .checkbox_label:hover {
                background-position: -13px -116px;
            }

        .checked {
            background-position: -13px -216px;
        }

            .checked:hover {
                background-position: -13px -216px;
            }

        input[type=radio] {
            width: 0;
        }

        input[type=checkbox] {
            width: 0;
        }
    </style>
</head>
<body>
    <div style="margin:10px 0px;">
        <form id="form1">
            <table class="gridtable">
                <tr>
                    <td style="text-align:right; width:100px;">
                        路径名称：
                    </td>
                    <td>
                        <input type="text" id="txtPathWayName" name="txtPathWayName" class="l-text" style="width:250px;" value="@(dt.Rows[0]["name"])" /><font style="color:red;">&nbsp;*</font>
                    </td>
                </tr>
                <tr>
                    <td style="text-align:right; width:100px;">
                        路径编码：
                    </td>
                    <td>
                        <input type="text" id="txtPathWayCode" name="txtPathWayCode" class="l-text" style="width:250px;" value="@(dt.Rows[0]["code"])" /><font style="color:red;">&nbsp;*</font>
                    </td>
                </tr>
                <tr>
                    <td style="text-align:right; width:100px;">
                        操作者：
                    </td>
                    <td>
                        <input type="text" id="txtOpname" name="txtOpname" class="l-text" style="width:250px;" value="@(dt.Rows[0]["caozuozhe"])" /><font style="color:red;">&nbsp;*</font>
                    </td>
                </tr>
                <tr>
                    <td style="text-align:right; width:100px;">
                        操作时间：
                    </td>
                    <td>
                        <input type="text" id="txtOptime" name="txtOptime" class="l-text" style="width:250px;" value="@(dt.Rows[0]["create_time"])" /><font style="color:red;">&nbsp;*</font>
                    </td>
                </tr>
                <tr>
                    <td style="text-align:right; width:100px;">
                        关联诊断：
                    </td>
                    <td>
                        <label><input type="checkbox" id="chkzhenduan1" name="chkzhenduan" value="1" />胸痛</label>
                        <label><input type="checkbox" id="chkzhenduan2" name="chkzhenduan" value="2" />脑卒中</label>
                        <label><input type="checkbox" id="chkzhenduan3" name="chkzhenduan" value="3" />创伤</label>
                    </td>
                </tr>
                <tr>
                    <td style="text-align:right; width:100px;">
                        启用：
                    </td>
                    <td>
                        <label @(Convert.ToBoolean(dt.Rows[0]["enable"]) ? "class='checked'" : "")><input type="checkbox" id="chkenabled" name="chkenabled" value="1" @(Convert.ToBoolean(dt.Rows[0]["enable"]) ? "checked=checked" : "") />&nbsp;</label>
                    </td>
                </tr>
                <tr>
                    <td style="text-align:right; width:100px;">
                        排序：
                    </td>
                    <td>
                        <input type="text" id="txtIsort" name="txtIsort" style="width:250px;" value="@(dt.Rows[0]["sort"])" />
                    </td>
                </tr>
                <tr>
                    <td colspan="2" style="text-align:center;padding-top:10px;">
                        <input type="hidden" id="txtguanlianzhenliao" value="@(dt.Rows[0]["guanlianzhenliao"])" />
                        <input type="hidden" id="txtId" name="txtId" value="@(dt.Rows[0]["Id"])" />
                        <input id="btnSubmit" type="button" value="确定" class="l-button" onclick="save()" />&nbsp;&nbsp;&nbsp;
                        <input id="btnReset" type="reset" value="重置" class="l-button" />
                    </td>
                </tr>
                <tr></tr>
            </table>
        </form>
    </div>
    <script  >
        $(function () {

            CheckBoxSetVal("chkzhenduan", $("#txtguanlianzhenliao").val(), false)
        })
        function save() {
            if ($("#txtPathWayName").val() == "")
            { $("#txtPathWayName").focus(); return; }
            $("#chkenabled").val($('#chkenabled').is(':checked') ? "1" : "0");
            var editurl = "/ChestPainCenter/PathwayList/EditSubmit";
            var arr = $("#form1").serializeArray();
            var obj = {};
            for (var i = 0; i < arr.length; i++) {
                obj[arr[i].name] = arr[i]['value']
            }
            obj["chkzhenduan"] = CheckBoxToArrStr("chkzhenduan");
            $.post(editurl, obj, function (data, textStatus) {
                if (textStatus == "success") {
                    var d = $.parseJSON(data);
                    if (d.Result == 1) {
                        $.ligerDialog.success("保存成功", function () {
                            parent.window.btnSearch.click();
                            frameElement.dialog.close();
                        })
                    }
                    else if (d.Result == 0) {
                        $.ligerDialog.error(d.Body);
                    }
                    else {
                        $.ligerDialog.error("程序错误");
                    }
                } else { $.ligerDialog.error("程序错误"); }
            })
        }
        $(function () {

            //追加样式
            $("input[type=radio]").parent().addClass("radio_label");
            if (navigator.userAgent.indexOf("Firefox") > 0) { $(":radio,:checkbox").hide(); }
            $("input[type=radio][disabled!=disabled]").click(function () {
                $("input[type=radio][name='" + $(this).attr('name') + "']").parent().removeClass("checked")
                $(this).parent().addClass("checked");
            });
            $("input[type=radio][checked=checked]").parent().addClass("checked");
            $("input[type=checkbox]").parent().addClass("checkbox_label");
            $("input[type=checkbox][disabled!=disabled]").click(function (e) {
                if ($(this).parent().hasClass("checked"))
                    $(this).parent().removeClass("checked");
                else
                    $(this).parent().addClass("checked");
            });
            $("input[type=checkbox][checked=checked]").parent().addClass("checked");
        })
    </script>
</body>
</html>
